using System;
using System.Collections.Generic;
using System.Text;
using Business.Entities;
using Data.Database;

namespace Business.Logic
{
    public class MateriaLogic: BusinessLogic
    {
        #region Propiedad
        private MateriaAdapter _MateriaData;
        public MateriaAdapter MateriaData
        {
            get { return _MateriaData; }
            set { _MateriaData = value; }
        }
        #endregion

        #region Constructor
        public MateriaLogic()
        {
            this.MateriaData = new MateriaAdapter();
        }
        #endregion

        #region Metodos
        public Materias GetAll()
        {
            try
            {
                return MateriaData.GetAll();
            }
            finally
            {
                MateriaData = null;
            }
            
        }

        public Materias GetAllPorPlan(int ID)
        {
            MateriaAdapter MateriaData = new MateriaAdapter();
            try
            {
                return MateriaData.GetAllPorPlan(ID);
            }
            finally
            {
                MateriaData = null;
            }
        }

        public Materias GetOne(int ID)
        {
            MateriaAdapter MateriaData = new MateriaAdapter();
            try
            {
                return MateriaData.GetOne(ID);
            }
            finally
            {
                MateriaData = null;
            }
            
        }

        public void Delete(int ID)
        {
            try
            {
                MateriaData.Delete(ID);
            }
            finally
            {
                MateriaData = null;
            }
            
        }

        public void Save(Materia materia)
        {
            MateriaData.Save(materia);
        }

        public void Update(Materia materia)
        {
            try
            {
                MateriaData.Update(materia);
            }
            finally
            {
                MateriaData = null;
            }
        }

        public void Insert(Materia materia)
        {
            try
            {
                MateriaData.Insert(materia);
            }
            finally
            {
                MateriaData = null;
            }
        }
        #endregion
    }
}
